//
//  ScenesAudioManager.cpp
//  ScenesPlayer
//
//  Created by LaiFu Yang on 2017/2/20.
//  Copyright © 2017年 Scenes. All rights reserved.
//

#include "ScenesAudioManager.h"
#include "ScenesAudioManagerInternal.h"
#include "ScenesAudioUtils.h"



bool ScenesAudioManager::isScenesAudio(uint8_t* buff, int buffLen){
    return ScenesAudioUtils::isScenesAudio(buff, buffLen);
}

ScenesAudioManager::ScenesAudioManager()
: _internalPtr(nullptr)
{
    _internalPtr = new ScenesAudioManagerInternal();

}

ScenesAudioManager::~ScenesAudioManager() {

    delete _internalPtr;
    _internalPtr = nullptr;
}

bool ScenesAudioManager::openScenesAudioManager(IAudioDecoderFactory* audioDecoderFactory,
                                                int sampleRate,int channelsPerFrame,int bitsPerChannel) {
    return _internalPtr->openScenesAudioManager(audioDecoderFactory, sampleRate, channelsPerFrame, bitsPerChannel);
}

void ScenesAudioManager::shutdown() {
    _internalPtr->shutdown();
}

void ScenesAudioManager::clean() {
    _internalPtr->clean();
}

bool ScenesAudioManager::inputSampleData(uint8_t* buff, int buffLen, int64_t sampleTimeUs) {
    return _internalPtr->inputSampleData(buff, buffLen, sampleTimeUs);
}

bool ScenesAudioManager::outputSampleData(int64_t* out_sampleTimeUs) {
    return _internalPtr->outputSampleData(out_sampleTimeUs);
}

bool ScenesAudioManager::getMixAudioData(float in_angle,int64_t in_sampleTimeUs,
                                         uint8_t** out_buff,uint32_t* out_buffLen) {
    return _internalPtr->getMixAudioData(in_angle, in_sampleTimeUs, out_buff, out_buffLen);
}
